'use strict';
const { Controller } = require('egg');
const fs = require('fs-extra');
const p = require('path');

class FilmController extends Controller {
  async lastAdd() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    data.query = data?.query ?? {};
    let ret = await service.film.lastAdd(data);
    ctx.success(ret);
  }
  async doubanSearch() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.film.doubanSearch(data);
    ctx.success(ret);
  }
  async getDoubanItem() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.film.getDoubanItem(data);
    ctx.success(ret);
  }
  async recommendRandom() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.film.recommendRandom(data);
    ctx.success(ret);
  }
}

module.exports = FilmController;
